<?php
/* 
 * Copyright (c) 2018-2021  * 
 * 创建时间：2021-04-24 06:14
 *
 * 项目：upload  -  $  - levssqController.php
 *
 * 作者：liwei 
 */


namespace modules\levpays\controllers;

!defined('INLEV') && exit('Access Denied LEV');

use Lev;
use lev\base\Adminv;
use lev\base\Controllerv;
use lev\dz\discuzHelper;
use lev\widgets\uploads\uploadsWidget;

class AjaxController extends Controllerv {

    public function actionUploadSettings() {
        static::csrfValidation();
        Adminv::checkAccess();

        $field = Lev::stripTags(Lev::GETv('input'));

        echo Lev::jsonv(discuzHelper::upload($_FILES[$field], 'settings', 0));

    }

    /**
     * 仅允许上传图片附件
     */
    public function actionUploadImage() {
        static::csrfValidation();

        $field = Lev::stripTags(Lev::GETv('input'));

        echo Lev::jsonv(discuzHelper::upload($_FILES[$field], 'images', 1));

    }

    /**
     * 上传指定扩展名附件
     */
    public function actionUploadAttach() {
        static::csrfValidation();

        $field = Lev::stripTags(Lev::GETv('input'));

        echo Lev::jsonv(uploadsWidget::uploadInputExt($field, 'attach'));

    }
}




